<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 引入 -->
    <script src="../vue.js"></script>
    <style>
        *{
            margin: 0;
            padding: 0;
            list-style: none;
        }
        #ul{
            width: 400px;
            height: 100px;
            display: flex;
            background-color: #0094ff;
        }
        li{
            flex: 1;
            line-height: 100px;
            text-align: center;
            cursor: pointer;
            font-size: 16px;
        }
        .one{
            background-color: red;
            font-size: 30px;
        }
        .two{
            font-size: 16px;
            background-color: #0094ff;
        }
    </style>
</head>
<body>
    <div id="app">
    <ul id="ul">
        <li :class="classname[0]"  @click="fn($event,0)">首页</li>
        <li :class="classname[1]"  @click="fn($event,1)">体育</li>
        <li :class="classname[2]"  @click="fn($event,2)">军事</li>
        <li :class="classname[3]"  @click="fn($event,3)">生活</li>
    </ul>
    <div>{{ text }} </div>
</div>
    <script>
        new Vue({
            el:'#app',
            data:{
                classname:['one','two','two','two'],
                text:'首页'
            },
            methods:{
                fn(event,e){
                    this.classname=this.classname.map((val,index) => (index === e ? 'one' : 'two'))
                    this.text = event.target.textContent;
                }
            }
            
        })
    </script>
</body>
</html>